import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueDevTools(),
  ],
  server: {
    //配置反向代理
    proxy: {
      '/file': {
        target: 'http://192.168.124.5:8882/',
        changeOrigin: true
      },
      '/feasibility': {
        target: 'http://192.168.124.5:8882/',
        changeOrigin: true
      },
      '/tasks': {
        target: 'http://192.168.124.5:8882/',
        changeOrigin: true
      },
      '/log': {
        target: 'http://192.168.124.5:8882/',
        changeOrigin: true
      },
      '/placement': {
        target: 'http://192.168.124.5:8882/',
        changeOrigin: true
      },
      '/tolerance': {
        target: 'http://192.168.124.5:8882/'
      }
    }
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    },
  },
})
